//
//  ZDSafeMutableArray.h
//  Location_Demo
//
//  Created by JXH on 2021/1/14.
//

#import <Foundation/Foundation.h>

@interface ZDSafeMutableArray : NSObject
#pragma mark - -------------- init method -----------------
+ (instancetype)safetyArray;
+ (instancetype)safetyArrayWithArray:(NSArray *)array;
+ (instancetype)arrayWithCapacity:(NSUInteger)capacity;
- (instancetype)initWithArray:(NSArray *)array;
- (instancetype)initWithCapacity:(NSUInteger)capacity;
#pragma mark - -------------- read -----------------
//集合元素数量
- (NSUInteger)count;
//获取元素
- (id)objectAtIndex:(NSUInteger)index;
//判断是否包含对象
- (BOOL)containsObject:(id)anObject;
//获取索引
- (NSUInteger)indexOfObject:(id)anObject;
#pragma mark - -------------- write -----------------
//插入
- (void)addObject:(id)anObject;
//插入
- (void)insertObject:(id)anObject atIndex:(NSUInteger)index;
//替换
- (void)replaceObjectAtIndex:(NSUInteger)index withObject:(id)anObject;
//移除
- (void)removeObjectAtIndex:(NSUInteger)index;
//移除
- (void)removeObject:(id)anObject;
//移除
- (void)removeLastObject;
//移除
- (void)removeAllObjects;

@end
